nanopyx.liquid.__njit__

 1import warnings
 2
 3try:
 4    from numba import njit, prange
 5
 6except ImportError:
 7    # raise a warning that numba is not installed
 8    # and that the njit functions will not be used
 9    # and that the pure python functions will be used instead
10
11    prange = range
12
13    def njit(*args, **kwargs):
14        def wrapper(func):
15            warnings.warn(
16                f"Numba is not installed. Using pure python for {func.__name__}"
17            )
18            return func
19
20        return wrapper
21
22
23def njit_works():
24    """
25    Checks if the system has Numba compatibility
26    :return: True if the system has Numba compatibility, False otherwise
27    """
28    try:
29        from numba import njit, prange
30
31        return True
32
33    except ImportError:
34        return False
def njit_works():
24def njit_works():
25    """
26    Checks if the system has Numba compatibility
27    :return: True if the system has Numba compatibility, False otherwise
28    """
29    try:
30        from numba import njit, prange
31
32        return True
33
34    except ImportError:
35        return False

Checks if the system has Numba compatibility

Returns

True if the system has Numba compatibility, False otherwise

def njit(*args, **kwargs):
14    def njit(*args, **kwargs):
15        def wrapper(func):
16            warnings.warn(
17                f"Numba is not installed. Using pure python for {func.__name__}"
18            )
19            return func
20
21        return wrapper